package com.lai.note.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import com.lai.note.fragment.PersonFragment;
import com.lai.note.fragment.RandomWenanFragment;
import com.lai.note.fragment.RecordsNoteFragment;
import com.lai.note.fragment.RecordsWenanFragment;
import com.lai.note.fragment.WriteNoteFragment;
import com.lai.note.fragment.WriteWenanFragment;

public class MyFragmentStateAdapter extends FragmentStateAdapter {
    public MyFragmentStateAdapter(FragmentActivity  fragmentActivity){
        super(fragmentActivity);
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        switch(position){
            case 0:
                return new RandomWenanFragment();
            case 1:
                return new WriteWenanFragment();
            case 2:
                return new WriteNoteFragment();
            case 3:
                return new PersonFragment();
        }
        return null;
    }

    @Override
    public int getItemCount() {
        return 4;
    }
}
